/**
 * 
 *	起迪科技
 * Copyright (c) 2014-2018 QiDi,Inc.All Rights Reserved.
 */
package cn.qidisoft.edu.hzjt.utils;

/**
 * 
 * @author Administrator
 * @version $Id: validationSqlString.java, v 0.1 2018年12月7日 下午3:33:37 Administrator Exp $
 */
public class validationSqlString {
    /**
     * 汉字和字符长度判断sql2008
     * 
     * @param s
     * @return
     */
    public static int lengthSql2008(String s) {
        int length = 0;
        for (int i = 0; i < s.length(); i++) {
            int ascii = Character.codePointAt(s, i);
            if (ascii >= 0 && ascii <= 255)
                length++;
            else
                length += 2;

        }
        return length;

    }

}
